<template>
  <div class="search">
    <f-form ref="form" :action="api.bag" :form-key="this.formItem.airportGiveGoodsNumId" >
      <f-form-item label="机场Id"  name="airportId" dataType="${formField.dataType}"   :value="formItem.airportId" />
      <f-form-item label="商品Id"  name="goodsId" dataType="${formField.dataType}"   :value="formItem.goodsId" />
      <f-form-item label="可赠送数量"  name="giveGoodsNum" dataType="number"   :value="formItem.giveGoodsNum" />
      <f-form-item label="操作人员"  name="optUserId" dataType="${formField.dataType}"   :value="formItem.optUserId" />
      <f-form-item label="是否删除"  name="deleted" dataType="number"   :value="formItem.deleted" />
      <f-form-item label="更新人"  name="updateUser" dataType="${formField.dataType}"   :value="formItem.updateUser" />
      <f-form-item label="更新时间"  name="updateTime" dataType="${formField.dataType}"   :value="formItem.updateTime" />
      <f-form-item label="创建人"  name="createUser" dataType="${formField.dataType}"   :value="formItem.createUser" />
      <f-form-item label="创建时间"  name="createTime" dataType="${formField.dataType}"   :value="formItem.createTime" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'bagForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          airportGiveGoodsNumId: '',
          airportId: '',
          goodsId: '',
          giveGoodsNum: '',
          optUserId: '',
          deleted: '',
          updateUser: '',
          updateTime: '',
          createUser: '',
          createTime: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.airportGiveGoodsNumId) {
          let params={
              airportGiveGoodsNumId:data.airportGiveGoodsNumId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
